package com;

public class Chinese implements Person{
    private String name;
    private int age;
    private Person p;
    public Chinese(){
        System.out.println("chi空参");
    };

    public Chinese(Person p) {
        this.p = p;
    }

    public Chinese(String name) {
        this.name = name;
    }

    public Chinese(int age) {
        this.age = age;
    }

    public Chinese(String name, int age, Chinese p) {
        this.name = name;
        this.age = age;
        this.p = p;
        System.out.println("chi全参");
    }

    public Person getP() {
        return p;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setP(Person p) {
        System.out.println("用了set方法");
        this.p = p;
    }

    public void eat(){
        System.out.println(1);
    }

    @Override
    public String toString() {
        return "Chinese{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", p=" + p +
                '}';
    }
}
